<?php

namespace vico\reservarBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;

/**
 * bookings
 *
 * @ORM\Table(name="bookings")
 * @ORM\Entity(repositoryClass="vico\reservarBundle\Entity\BookingRepository")
 */
class Booking
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var string
     *
     * @ORM\Column(name="bookcode", type="string", length=20)
     */
    private $bookcode;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="created", type="datetime",nullable=true)
     */
    private $created;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="payed", type="datetime",nullable=true)
     */
    private $payed;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="booked", type="datetime",nullable=true)
     */
    private $booked;

    /**
     * @ORM\ManyToOne(targetEntity="Paymethod")
     */
    private $paymethod;

    /**
     * @var float
     *
     * @ORM\Column(name="amount", type="float",nullable=true)
     */
    private $amount;

    /**
     * @ORM\ManyToOne(targetEntity="Status")
     */
    private $status;

    /**
     * @var string
     *
     * @ORM\Column(name="comment", type="string", length=512,nullable=true)
					* @Assert\NotBlank()
					*
     */
    private $comment;

    /**
     * @var string
     *
     * @ORM\Column(name="ext_response", type="string", length=80,nullable=true)
     */
    private $ext_response;

    /**
     * @ORM\ManyToOne(targetEntity="Usuario")
     */
    private $operator;

    /**
     * @var string
     *
     * @ORM\Column(name="coordinator", type="string", length=60,nullable=true)
     */
    private $coordinator;

    /**
     * @var string
     *
     * @ORM\Column(name="aux", type="string", length=80,nullable=true)
     */
    private $aux;

    /**
     * @ORM\ManyToOne(targetEntity="Customer")
     */
    private $customer;

    /**
     * @ORM\ManyToMany(targetEntity="Product")
     */
    private $product;
				
	public function __construct(){
	    $length =   6;
	    $charList  =   array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','0','1','2','3','4','5','6','7','8','9');
     $ticket = '';
     for ($count = 0; $count < $length; $count++){
          $newChar = $charList[rand(0,count($charList)-1)];
          if (rand(0,1) == 0) $newChar = strtolower($newChar);
          $ticket .= $newChar;
     }
	$this->bookcode = $ticket;
	}

    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set bookcode
     *
     * @param string $bookcode
     * @return Booking
     */
    public function setBookcode($bookcode)
    {
        $this->bookcode = $bookcode;
    
        return $this;
    }

    /**
     * Get bookcode
     *
     * @return string 
     */
    public function getBookcode()
    {
        return $this->bookcode;
    }

    /**
     * Set created
     *
     * @param \DateTime $created
     * @return Booking
     */
    public function setCreated($created)
    {
        $this->created = $created;
    
        return $this;
    }

    /**
     * Get created
     *
     * @return \DateTime 
     */
    public function getCreated()
    {
        return $this->created;
    }

    /**
     * Set payed
     *
     * @param \DateTime $payed
     * @return Booking
     */
    public function setPayed($payed)
    {
        $this->payed = $payed;
    
        return $this;
    }

    /**
     * Get payed
     *
     * @return \DateTime 
     */
    public function getPayed()
    {
        return $this->payed;
    }

    /**
     * Set booked
     *
     * @param \DateTime $booked
     * @return Booking
     */
    public function setBooked($booked)
    {
        $this->booked = $booked;
    
        return $this;
    }

    /**
     * Get booked
     *
     * @return \DateTime 
     */
    public function getBooked()
    {
        return $this->booked;
    }

    /**
     * Set paymethod
     *
     * @param string $paymethod
     * @return Booking
     */
    public function setPaymethod($paymethod)
    {
        $this->paymethod = $paymethod;
    
        return $this;
    }

    /**
     * Get paymethod
     *
     * @return string 
     */
    public function getPaymethod()
    {
        return $this->paymethod;
    }

    /**
     * Set amount
     *
     * @param float $amount
     * @return Booking
     */
    public function setAmount($amount)
    {
        $this->amount = $amount;
    
        return $this;
    }

    /**
     * Get amount
     *
     * @return float 
     */
    public function getAmount()
    {
        return $this->amount;
    }

    /**
     * Set status
     *
     * @param string $status
     * @return Booking
     */
    public function setStatus($status)
    {
        $this->status = $status;
    
        return $this;
    }

    /**
     * Get status
     *
     * @return string 
     */
    public function getStatus()
    {
        return $this->status;
    }

    /**
     * Set comment
     *
     * @param string $comment
     * @return Booking
     */
    public function setComment($comment)
    {
        $this->comment = $comment;
    
        return $this;
    }

    /**
     * Get comment
     *
     * @return string 
     */
    public function getComment()
    {
        return $this->comment;
    }

    /**
     * Set ext_response
     *
     * @param string $ext_response
     * @return Booking
     */
    public function setExtResponse($ext_response)
    {
        $this->ext_response = $ext_response;
    
        return $this;
    }

    /**
     * Get ext_response
     *
     * @return string 
     */
    public function getExtResponse()
    {
        return $this->ext_response;
    }

    /**
     * Set operator
     *
     * @param string $operator
     * @return Booking
     */
    public function setOperator($operator)
    {
        $this->operator = $operator;
    
        return $this;
    }

    /**
     * Get operator
     *
     * @return string 
     */
    public function getOperator()
    {
        return $this->operator;
    }

    /**
     * Set coordinator
     *
     * @param string $coordinator
     * @return Booking
     */
    public function setCoordinator($coordinator)
    {
        $this->coordinator = $coordinator;
    
        return $this;
    }

    /**
     * Get coordinator
     *
     * @return string 
     */
    public function getCoordinator()
    {
        return $this->coordinator;
    }

    /**
     * Set aux
     *
     * @param string $aux
     * @return Booking
     */
    public function setAux($aux)
    {
        $this->aux = $aux;
    
        return $this;
    }

    /**
     * Get aux
     *
     * @return string 
     */
    public function getAux()
    {
        return $this->aux;
    }

    /**
     * Set customer
     *
     * @param string $customer
     * @return Booking
     */
    public function setCustomer($customer)
    {
        $this->customer = $customer;
    
        return $this;
    }

    /**
     * Get customer
     *
     * @return string 
     */
    public function getCustomer()
    {
        return $this->customer;
    }

    /**
     * Set product
     *
     * @param string $product
     * @return Booking
     */
    public function setProduct($product)
    {
        $this->product = $product;
    
        return $this;
    }

    /**
     * Get product
     *
     * @return string 
     */
    public function getProduct()
    {
        return $this->product;
    }
}
